import request, { RequestReturnType } from '/@/utils/request'

// 获取所有广告
export const getAdList = (): RequestReturnType => {
  return request({
    method: 'GET',
    url: '/front/ad/getAdList'
  })
}
// 获取所有位置列表
export const getAllSpaces = (): RequestReturnType => {
  return request({
    method: 'GET',
    url: '/front/ad/space/getAllSpaces'
  })
}

// 更改广告状态
export const updateStatus = (id: number, status: 0|1): RequestReturnType => {
  return request({
    method: 'GET',
    url: '/front/ad/updateStatus',
    params: { id, status }
  })
}

// 添加或者编辑广告
export const saveOrUpdate = (data:any): RequestReturnType => {
  return request({
    method: 'POST',
    url: '/front/ad/saveOrUpdate',
    data
  })
}
